﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks.Movement;

public class MonsterManager : MonoBehaviour {

    public GameObject mWolf,mZombi,mOrc;
    public GameObject blackHolePreafab;
    public GameObject pet;
    public ArrayList monList = new ArrayList();

    private BehaviorTree[] enemysBehaviors;
    private BehaviorTree bossBehaviorTree;

    // Use this for initialization
    void Start () {
      
	}
	
	// Update is called once per frame
	void Update () {
		
	}
    /****
    public void CreateMonsters()
    {
        int type = Random.RandomRange(0, 2);

        switch (type)
        {
            case 0:
                monList.Add(Instantiate(mWolf, new Vector3(0, 0, 0), Quaternion.identity));
                break;
            case 1:
                monList.Add(Instantiate(mZombi, new Vector3(0, 0, 0), Quaternion.identity));
                break;
            case 2:
                monList.Add(Instantiate(mOrc, new Vector3(0, 0, 0), Quaternion.identity));
                break;

        }
    }
    ***/
    
    /// <summary>
    ///  小怪死亡
    /// </summary>
    public void MonsterDie()
    {

        enemysBehaviors = transform.GetComponentsInChildren<BehaviorTree>();
        for (int i = 0; i < enemysBehaviors.Length; i++)
         {
                enemysBehaviors[i].GetVariable("HP").SetValue(0);//设置行为树里面的变量HP等于0
         }

    }

}
